<?php

class DBhandler {
    private $user = "";
    private $pass = "";
    private $host = "";
    private $dbname = "";
    
    function DBhandler(){
        if(mysql_connect($host, $user, $pass)){
         if(!mysql_select_db($dbname)){
             echo "Could not select to correct database";
         }
      }
      else {
          echo "Database login failed!";
      }
    }

    /**
     * Function to be used in case of INSERT,DELETE or UPDATE query
     * @param String $Sql - The query String
     * @return <type> 1 if the query was run<br>0 if there was a problem
     */
   public function oneWaySQL($Sql){
       if(mysql_query($sql)){
            $value = 1;
       }
       else {
           $value = 0;
       }
       return $value;
   }
   /**
    * Function to be used in case of SELECT query
    * @param String $sql The SQL query String
    * @return ResultSet $rs which represents the ResultSet gained from the query
    */
   public function getData($sql){
       $rs = mysql_query($sql);
       return $rs;
   }
}
?>